package com.pzhu.acargid.doc;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pzhu.acargid.domain.Doc;
import com.pzhu.acargid.vo.VO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author Lenovo
 * @description 针对表【doc】的数据库操作Mapper
 * @createDate 2023-08-13 15:48:26
 * @Entity generator.domain.Doc
 */
@Mapper
public interface DocMapper extends BaseMapper<Doc> {

    Integer removed(@Param("userid") Integer userid, @Param("type") String type, @Param("ids") List<Integer> ids);

    @Update("update doc set removed=0 where user_id = #{userid} and id = #{docid} and removed = 1")
    Integer restore(@Param("userid") Integer userid, @Param("docid") Integer docid);

    @Select("select * from doc left join ${model} on id= doc_id where id=#{id} and user_id=#{userid} and removed=0 and mod_db_table=#{model} ")
    VO getbyid(@Param("userid") Integer userid, @Param("id") String id, @Param("model") String model);
}




